package com.aigua.order.controller;

import com.aigua.order.fegin.UserFegin;
import com.aigua.order.service.OrderService;
import com.aigua.pojo.Order;
import com.aigua.pojo.User;
import com.aigua.vo.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @TODO:
 * @Author:baimu
 * @Date:2024 03 29 15 11
 **/

@RestController
@RequestMapping("/v1/admin/order")
public class OrderController {
    @Autowired
    OrderService orderService;

    @Autowired
    UserFegin userFegin;


    @GetMapping("/findAll")
    public CommonResult findAll(){
        List<Order> list = orderService.list();
        return CommonResult.success(list);

    }

   @GetMapping("/findById")
    public CommonResult findById(@RequestParam Integer id){
        return CommonResult.success(orderService.findById(id));
    }

   @PostMapping("/login")
    public CommonResult login(){
       User user = new User(1,"1","22");

       CommonResult login = userFegin.login(user);
       return login;
   }

}
